package com.wang.utils;


import lombok.*;

import java.io.Serializable;

/**
 * @Classname ResponseUtil
 * @Description TODO
 * @Date 2024/9/25 14:42
 * @Created by pc
 */
@Data
@ToString
@NoArgsConstructor
public class ResponseUtil{
    // 请求状态码
    private Integer code;
    // 消息提示
    private String msg;
    // 需要携带的参数
    private Object data;


    public ResponseUtil(Integer code, String msg, Object data) {
        this.code = code;
        this.msg = msg;
        this.data = data;
    }

    public static ResponseUtil get(ResponseEnum responseEnum, Object object){
        return new ResponseUtil(responseEnum.getCode(),responseEnum.getMsg(),object);
    }
    public static ResponseUtil get(ResponseEnum responseEnum){
        return new ResponseUtil(responseEnum.getCode(),responseEnum.getMsg(),null);
    }
}

